SET DEFINE OFF;
Insert into CRM_OWNER_USER.SYS_DEPT
   (DEPT_ID, DEPT_NAME, PARENT_DEPT_ID, PARENT_DEPT_IDS, SORTSTRING, IF_VALID, OPERATOR, OPERATOR_TIME, OPERATOR_ID)
 Values
   ('1', '技术部', '0', '0', '1', 
    '1', '1', TO_DATE('12/30/1899 01:00:00', 'MM/DD/YYYY HH24:MI:SS'), '1');
Insert into CRM_OWNER_USER.SYS_DEPT
   (DEPT_ID, DEPT_NAME, PARENT_DEPT_ID, PARENT_DEPT_IDS, SORTSTRING, IF_VALID, OPERATOR, OPERATOR_TIME, OPERATOR_ID)
 Values
   ('2', '后台', '1', '0/1', '1', 
    '1', '1', TO_DATE('12/30/1899 01:00:00', 'MM/DD/YYYY HH24:MI:SS'), '1');
Insert into CRM_OWNER_USER.SYS_DEPT
   (DEPT_ID, DEPT_NAME, PARENT_DEPT_ID, PARENT_DEPT_IDS, SORTSTRING, IF_VALID, OPERATOR, OPERATOR_TIME, OPERATOR_ID)
 Values
   ('3', 'JAVA', '2', '0/1/2', '1', 
    '1', '1', TO_DATE('12/30/1899 01:00:00', 'MM/DD/YYYY HH24:MI:SS'), '1');
Insert into CRM_OWNER_USER.SYS_DEPT
   (DEPT_ID, DEPT_NAME, PARENT_DEPT_ID, PARENT_DEPT_IDS, SORTSTRING, IF_VALID, OPERATOR, OPERATOR_ID)
 Values
   ('4', 'PHP', '2', '0/1/2', '1', 
    '1', '1', '1');
Insert into CRM_OWNER_USER.SYS_DEPT
   (DEPT_ID, DEPT_NAME, PARENT_DEPT_ID, PARENT_DEPT_IDS, SORTSTRING, IF_VALID, OPERATOR, OPERATOR_ID)
 Values
   ('5', '.NET', '2', '0/1/2', '1', 
    '1', '1', '1');
Insert into CRM_OWNER_USER.SYS_DEPT
   (DEPT_ID, DEPT_NAME, PARENT_DEPT_ID, PARENT_DEPT_IDS, SORTSTRING, IF_VALID, OPERATOR, OPERATOR_ID)
 Values
   ('6', 'SPRING', '3', '0/1/2/3', '1', 
    '1', '1', '1');
Insert into CRM_OWNER_USER.SYS_DEPT
   (DEPT_ID, DEPT_NAME, PARENT_DEPT_ID, PARENT_DEPT_IDS, SORTSTRING, IF_VALID, OPERATOR, OPERATOR_ID)
 Values
   ('7', '综合部', '0', '0', '1', 
    '1', '1', '1');
Insert into CRM_OWNER_USER.SYS_DEPT
   (DEPT_ID, DEPT_NAME, PARENT_DEPT_ID, PARENT_DEPT_IDS, SORTSTRING, IF_VALID, OPERATOR, OPERATOR_ID)
 Values
   ('8', '办卡处', '7', '0/7', '1', 
    '1', '1', '1');
COMMIT;


select * from SYS_DEPT 
start with parent_dept_id = 0
connect by prior dept_id =  parent_dept_id